#ifndef _OPENGL_VOLUME_RENDERER_H
#define _OPENGL_VOLUME_RENDERER_H

#include "../volumeEngineCore/volumeEngineCoreInterface.h"
#include "../common/volume/volumeManager.h"
#include "Utility/GLTexture.h"
#include "Utility/GLframeBufferObject.h"

class openGLVolumeRenderer: public volumeEngineCoreInterface
{
public:
	//setup render buffer, create all shader prog, TF, 
	openGLVolumeRenderer();
	~openGLVolumeRenderer();
	virtual void destroyObject();
	virtual bool InitEngine(int w, int h);
	virtual void Render();
	virtual void RenderToImage();	
	virtual void Resize(int w, int h) ;
	virtual void Refresh(); // reload shader etc.

	virtual void Init1DTF(int dataSize, int tableSize);
	virtual void Update1DTF(void* buffer);

	virtual void SetViewingParameters(parameterViewing &paraV); 
	virtual void SetShadingParameters(parameterShading &paraS);
	virtual bool LoadCoreStatusFromFile(const char* filename);
	virtual bool SaveCoreStatusToFile(const char* filename);

	virtual bool loadSingleVolume(const char* filename);
	//OpenGL related
	void InitGL();

protected:
	bool createFBO();
	bool createProgram();
	bool createTF();

	//in base class
	//	int _width, _height; //viewport size
	//  parameterShading _paraS;
	//  parameterViewing _paraV;
	//	volumeManager *_volMan;

	//test
	GLTexture* tex;
	GLuint m_backface, m_raycast;
	FramebufferObject *fboBackFace, *fboRaycast;

	

};

#endif